package com.lanou3g.practice;

import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.net.InetSocketAddress;
import java.net.Socket;
import java.util.Scanner;

/**
 * Created by dllo on 18/4/24.
 */
public class Client {
    public static void main(String[] args) {

        Socket socket = new Socket();
        Scanner scanner = new Scanner(System.in);
        PrintWriter pw = null;
        try {

            socket.connect(new InetSocketAddress("127.0.0.1",7788));
            new ReadThread(socket).start();
            pw = new PrintWriter(new OutputStreamWriter(socket.getOutputStream()));
            while (true){
                String s = scanner.nextLine();
                pw.println(s);
                pw.flush();
            }


        } catch (Exception e) {
            e.printStackTrace();
        }


    }
}
